// 封装频道列表自定义hook函数
import { useState,useEffect } from "react"
import { getChannelsAPI } from "@/apis/article"
function useChannel() {
  const [channelList,setChannelList] = useState([])
  useEffect(() => {
    // 1、封装一个获取频道列表函数
    const getChannelList = async() => {
      const res = await getChannelsAPI()
      setChannelList(res.data.data.channels)
    }
    getChannelList()
  },[])
  return {
    channelList
  }
}

export {useChannel}